<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form ref="queryForm" :inline="true">
        <el-form-item label="操作时间">
          <el-date-picker v-model="daterange"  type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
          <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> -->
        </el-form-item>
      </el-form>
    </div>
    <!-- 管理员操作日志 -->
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="name" label="操作者"></el-table-column>
      <el-table-column prop="createTime" label="时间">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="ip" label="IP"></el-table-column>
      <el-table-column prop="queryParam" label="操作记录"></el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  </div>
</template>

<script>
import { list } from '@/api/sys/logadmin';
export default {
  data() {
    return {
      tableData: [],
      daterange:[],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 20
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      list(this.addDateRange(this.queryParams,this.daterange)).then(res => {
        this.tableData = res.result.list;
        this.total = res.result.total;
        this.loading = false;
      });
    },
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    }
  }
};
</script>

<style></style>
